package com.raising.sc.controller;

import com.raising.sc.model.Country;
import com.raising.sc.model.Currency;
import com.raising.sc.model.GetCountryRequest;
import com.raising.sc.model.GetCountryResponse;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;

@Endpoint
public class CountryEndpoint {
    private static final String NAMESPACE_URI = "http://www.yourcompany.com/webservice";

    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getCountryRequest")
    @ResponsePayload
    public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) {
        GetCountryResponse response = new GetCountryResponse();
        Country country = new Country();
        country.setCapital("capital");
        country.setCurrency(Currency.EUR);
        country.setName("name");
        country.setPopulation(10);
        response.setCountry(country);

        return response;
    }
}